package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.LeafWorkerId;
import com.ruoyi.system.mapper.LeafWorkerIdMapper;
import com.ruoyi.system.service.LeafWorkerIdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @description: TODO
 * @Author: Zhuzhi
 * @Date: 2020/12/13 下午10:04
 */
@Service
public class LeafWorkerIdServiceImpl implements LeafWorkerIdService {

    @Autowired
    LeafWorkerIdMapper leafWorkerIdMapper;


    @Override
    public List<LeafWorkerId> selectLeafWorkerIdList(String namespace, String hostIp) {
        Map<String, String> paramMap = new HashMap<>(4);
        paramMap.put("namespace", namespace);
        paramMap.put("hostIp", hostIp);
        return leafWorkerIdMapper.selectLeafWorkerIdList(paramMap);
    }

    @Override
    public int insertLeafWorkerId(LeafWorkerId leafWorkerId) {
        return leafWorkerIdMapper.insertLeafWorkerId(leafWorkerId);
    }

    @Override
    public int deleteLeafWorkerById(long id) {
        return leafWorkerIdMapper.deleteLeafWorkerById(id);
    }

    @Override
    public LeafWorkerId selectLeafWorkerId(String namespace, String hostIp, Integer workerId) {
        Map<String, Object> paramMap = new HashMap<String, Object>(4);
        paramMap.put("namespace", namespace);
        paramMap.put("hostIp", hostIp);
        paramMap.put("workerId", workerId);
        return leafWorkerIdMapper.selectLeafWorkerId(paramMap);
    }
}
